package com.icss.action.login;

import java.util.Map;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.apache.struts2.ServletActionContext;

import com.icss.action.BaseAction;
import com.icss.service.login.LoginService;

/**
 * 登陆相关功能
 * @author shixiaolong
 * Jun 7, 2012
 */
public class LoginAction extends BaseAction{
	
	private LoginService loginService;
	
	
	public LoginService getLoginService() {
		return loginService;
	}

	public void setLoginService(LoginService loginService) {
		this.loginService = loginService;
	}

	/**
	 * 用户登陆验证
	 * @return
	 */
	public String login(){
		int result = loginService.login(request);
		if(result ==1){
			return "success";
		}else{
			request.setAttribute("loginResult", result);
			return "error";
		}
	}
	
	/**
	 * 用户注销
	 * @author xujin
	 * @return
	 */
	public String logoff(){
	 
	   return loginService.loginOff(request);
		 
	}
	
	/**
	 * 密码修改
	 * @return
	 */
	public String changePassword(){
		int result = loginService.changePassword(request);
		request.setAttribute("changeResult", result);
		return "changePassword";
			
	}
	
}
